#!/usr/bin/env python
# encoding: utf-8
"""
@summary: 成型的受欢迎程度；mapper计算
@author: hongxingfan
@since: 2014年8月7日    上午11:20:04
"""
import sys
from Url import UrlUtil
import re

if __name__ == "__main__":
    
    pattern_model = re.compile(r"model_(\d+)")
    pattern_trim = re.compile(r"trim-(\d+)")
    
    for line in sys.stdin:
        u = UrlUtil(line)
        if u.isRightful():
            type = ""
            typeId = ""
            pv = 1
            match_model = pattern_model.search(u.url)
            if match_model:
                type = "model"
                typeId = match_model.group(1)
            else:
                match_trim = pattern_trim.search(u.url)
                if match_trim:
                    type = "trim"
                    typeId = match_trim.group(1)
                else:
                    continue
            print("%s\t%s\t%s\t%s" % (type, typeId, pv, u.suv))
        else:
            continue
